home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / progs / thor / bbsread / addfilelist.br next >
Text File  |  1996-11-10  |  2KB  |  112 lines

  1. /* AddFileList.br 
  2.  *
  3.  * Arexx script to add a FLIM ABBS file list to the database.
  4.  */
  5.     options results
  6. /*    trace results */
  7.  
  8.     parse arg argument
  9.  
  10.     template = 'BBSNAME/A,FILENAME/A'
  11.  
  12.     if(argument = '' | argument = '?') then
  13.     do
  14.         say '$VER: AddFileList.br V4.1 (2.7.95)'
  15.         say 'Template:' template
  16.         exit
  17.     end
  18.  
  19.     if ~show('p', 'BBSREAD') then do
  20.         address command
  21.             "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  22.             "WaitForPort BBSREAD"
  23.     end
  24.  
  25.     address BBSREAD
  26.  
  27.     READARGS template ARGS CMDLINE argument
  28.     if(rc ~= 0) then 
  29.     do
  30.         say BBSREAD.LASTERROR
  31.         exit
  32.     end
  33.  
  34.     if(~OPEN(fh,ARGS.FILENAME,'Read')) then 
  35.     do
  36.         say 'Unable to open file'
  37.         exit
  38.     end
  39.  
  40.     farea = ''
  41.  
  42.     rc = 0
  43.     signal on ERROR
  44.     signal on BREAK_C
  45.     signal on HALT
  46.  
  47.     BUFMODE COPYBACK        /* Enable copyback buffer mode */
  48.  
  49.     do until eof(fh)
  50.         aline = readln(fh)
  51.  
  52.         if(left(aline, 21) = 'Listing of directory ') then 
  53.         do
  54.             farea = '"' || strip(substr(aline, 22),'T',':') || '"'
  55.  
  56.             say '0A'x || '(' || strip(farea,'B', '"') || ')'
  57.  
  58.             CONFIGFAREA '"' || ARGS.BBSNAME || '"' farea 
  59.         end
  60.         else
  61.         do
  62.             if farea ~= '' then
  63.             do
  64.                 aline = substr(aline,3)
  65.                 parse var aline fname fdate fsize fdnls fdescr
  66.  
  67.                 if(datatype(fdate,'W') & datatype(fsize,'W') & datatype(fdnls,W)) then
  68.                 do
  69.                     drop CD.
  70.                     CD.MDAY  = left(fdate,2)
  71.                     CD.MONTH = substr(fdate,3,2)
  72.                     CD.YEAR  = right(fdate,2)
  73.                     if CD.YEAR < 78 then CD.YEAR = CD.YEAR + 2000
  74.                     else CD.YEAR = CD.YEAR + 1900
  75.                 
  76.                     DATE2AMIGA CD
  77.                     convfdate = result
  78.  
  79.                     say left(fname, 18) fdate right(fsize, 7) right(fdnls, 3) strip(fdescr)
  80.                 
  81.                     drop BRFILE.
  82.  
  83.                     BRFILE.NAME      = fname
  84.                     BRFILE.DATE      = convfdate
  85.                     BRFILE.SIZE      = fsize
  86.                     BRFILE.DOWNLOADS = fdnls
  87.                 
  88.                     if fdescr ~= '' then
  89.                     do
  90.                         BRFILE.DESCRIPTION.COUNT = 1
  91.                         BRFILE.DESCRIPTION.1 = strip(fdescr)
  92.                     end
  93.  
  94.                     WRITEBRFILE '"' || ARGS.BBSNAME || '"' farea stem BRFILE 
  95.                 end
  96.             end
  97.         end
  98.     end
  99.  
  100. ERROR:
  101. HALT:
  102. BREAK_C:
  103.  
  104.     if(rc ~= 0) then 
  105.     do
  106.         say 'Error' rc 'in line' SIGL ':' BBSREAD.LASTERROR
  107.     end
  108.  
  109.     BUFMODE ENDCOPYBACK        /* Disable copyback buffer mode */
  110.  
  111.     exit
  112.